home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 3.iso
/
bin
/
forum
/
snt2wsnt
< prev
next >
Wrap
Text File
|
1996-11-11
|
3KB
|
80 lines
#!/bin/nawk -f
# convert snt (showcase based) to wsnt (web based)
BEGIN {if ( ! slug ) slug="filename";
getline;
streams = $0;
print streams;
getline;
scfile=$0;
printf "%s%s.html\n", dir, slug;
getline;
audiofile = $0;
printf "%s.mpga\n", slug;
if(make_event_titles != 0){
event_file = "event.titles";
system( "rm -f " event_file);
}
pg=0;page=1;pi=1;printf "NETSCAPE BEGIN 1\n";
}
!/^#/ {
sub(/advancedVRML2/,"HTML");sub(/http:..snt.*HTML/,dir "HTML");
if ($2 == "FORWARD") {pi= 1;print_it($3)};
if ($2 == "REVERSE") {pi=-1;print_it($3)};
if ($2 == "BEGIN") {page=1;
#printf "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg++, 1;
#print_it(1);
}
if ($1 == "SNAP") {pi= 1;print_it($3);
tmp = sprintf("ln -sf %s %s%03d.rgb", $2, slug, pg);
system (tmp);};
if ($1 == "NETSCAPE") {print $0; pi=1; print_it(0.01);
tmp = sprintf("if [ -r %s ]; then cp %s %s%03d.rgb; fi", "foo.rgb", "foo.rgb", slug, pg);
system (tmp);};
}
END {pi=1;print_it(1);#printf "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, 1000;
}
function print_it(foo){
do_quick_removal = 5000;
pg++;
if (foo != 0.01) {
if (foo <= do_quick_removal) {
skip_quick_events += foo;
printf "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, 0;
} else {
printf "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, foo+skip_quick_events;
skip_quick_events = 0;
}
}
if(make_event_titles != 0){
tmp=sprintf("make_csnt %d > %s%03d.csnt", pg, slug, pg);
system(tmp);
tmp=sprintf("echo %d\\ %d\\ `take_line line=%d < slides.titles` >> %s", pg, page, page, event_file);
system(tmp);
}
page = page + pi;
}
##foo# !/^#/ {
##foo# if ($2 == "FORWARD") { page++;}
##foo# if ($2 == "REVERSE") { page--;}
##foo# if ($2 != "BEGIN"){pg++;
##foo# printf "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, page, $3;
##foo# tmp=sprintf("make_csnt %d > %s%03d.csnt", pg, slug, pg);
##foo# system(tmp);
##foo# tmp=sprintf("take_line line=%d < slides.titles >> %s", page, event_file);
##foo# system(tmp);
##foo# }
##foo# }
##foo#
##foo# END {tmp = slug ".event_count";
##foo# printf ("%d\n", pg) > tmp;}
##foo#